<?php
/**
 * Inter_Session_Operator_Simulator类配置
 * @author Horse Luke<horseluke@126.com>
 * @copyright Horse Luke, 2010
 * @license the Apache License, Version 2.0 (the "License"). {@link http://www.apache.org/licenses/LICENSE-2.0}
 * @version $Id: Inter_Session_Operator_Simulator.php 151 2011-01-25 01:09:21Z horseluke@126.com $
 * @package Inter_Session
 * @subpackage Inter_Session_Config
 */
$_config = array(

    /**
     * 用于Inter_Session_Operator_Simulator中的Hash校验
     * @see Inter_Session_Operator_Simulator::_generateSessionHash()
     * @var string
     */
    'SESSION_HASHKEY' => 'sdafdsafsdfasfs',


    /**
     * 是否读取php.ini中的相关配置？false则表示不读取，使用该配置文件的默认值；true表示读取
     * @var bool
     */
    'READ_PHP_INI' => true,

    /**
     * 与php.ini中的session.name一致
     * @var string
     */
    'session.name' => 'SPHPSESSID',

    /**
     * 与php.ini中的session.use_cookies一致，但注意请使用true或者false设定
     * （此设定在Inter_Session_Operator_Simulator事实无效）
     * @var bool
     */
    'session.use_cookies' => true,


    /**
     * 与php.ini中的session.use_only_cookies一致，但注意请使用true或者false设定
     * @var bool
     */
    'session.use_only_cookies' => false,

    /**
     * 与php.ini中的session.cookie_lifetime一致
     * @var integer
     */
    'session.cookie_lifetime' => 0,

    /**
     * 与php.ini中的session.cookie_path一致
     * @var string
     */
    'session.cookie_path' => '/',

    /**
     * 与php.ini中的session.cookie_path一致
     * @var string
     */
    'session.cookie_domain' => '',

    /**
     * 与php.ini中的session.cookie_secure一致，但注意请使用true或者false设定
     * @var bool
     */
    'session.cookie_secure' => false,

    /**
     * 与php.ini中的session.cookie_httponly一致，但注意请使用true或者false设定
     * @var bool
     */
    'session.cookie_httponly' => false,

    /**
     * 与php.ini中的session.cache_limiter一致
     * @var string 可选值：none/nocache/private/private_no_expire/public
     * @see session_cache_limiter()
     */
    'session.cache_limiter' => 'nocache',


    /**
     * 与php.ini中的session.cache_expire一致，注意单位为分钟
     * @var integer
     * @see session_cache_expire()
     */
    'session.cache_expire' => 180,

    /**
     * 与php.ini中的session.save_path一致
     * @var string
     */
    'session.save_path' => '',

    /**
     * 与php.ini中的session.use_trans_sid一致，但注意请使用true或者false设定
     * @var bool
     */
    'session.use_trans_sid' => false,



    /**
     * （系统设定请勿动）session.cache_limiter为public所发送的header
     * @var string
     * @link http://cn.php.net/manual/zh/function.session-cache-expire.php
     */
    'header_cache_limiter_public' => 
        "Expires: %nexttime%\n\r".
        "Cache-Control: public, max-age=%expire%\n\r".
        "Last-Modified: %timestamp%",


    /**
     * （系统设定请勿动）session.cache_limiter为private_no_expire所发送的header
     * @var string
     * @link http://cn.php.net/manual/zh/function.session-cache-expire.php
     */
    'header_cache_limiter_private_no_expire' => 
        "Cache-Control: private, max-age=%expire%, pre-check=%expire%\n\r".
        "Last-Modified: %timestamp%",

    /**
     * （系统设定请勿动）session.cache_limiter为private所发送的header
     * @var string
     * @link http://cn.php.net/manual/zh/function.session-cache-expire.php
     */
    'header_cache_limiter_private' => 
        "Expires: Thu, 19 Nov 1981 08:52:00 GMT\n\r".
        "Cache-Control: private, max-age=%expire%, pre-check=%expire%\n\r".
        "Last-Modified: %timestamp%",

    /**
     * （系统设定请勿动）session.cache_limiter为nocache所发送的header
     * @var string
     * @link http://cn.php.net/manual/zh/function.session-cache-expire.php
     */
    'header_cache_limiter_nocache' => 
        "Expires: Thu, 19 Nov 1981 08:52:00 GMT\n\r".
        "Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\n\r".
        "Pragma: no-cache",

);

//读取php.ini设置
if(true == $_config['READ_PHP_INI']){
    $_config['session.cookie_lifetime'] = intval(ini_get('session.cookie_lifetime'));
    $_config['session.name'] = strval(ini_get('session.name'));
    $_config['session.cookie_path'] = strval(ini_get('session.cookie_path'));
    $_config['session.cookie_domain'] = strval(ini_get('session.cookie_domain'));
    $_config['session.cookie_secure'] = (bool)(ini_get('session.cookie_secure'));
    $_config['session.use_trans_sid'] = (bool)(ini_get('session.use_trans_sid'));
    if(PHP_VERSION >= '5.2.0' ){
        $_config['session.cookie_httponly'] = (bool)(ini_get('session.cookie_httponly'));
    }
}

return $_config;